<style>
    label:has(+[required])::before {
        content: "*";
        color: red;
    }
</style>
<div>
    <label for="name">姓名</label>
    <input required type="text" id="name">
</div>
<div>
    <label for="phone">电话</label>
    <input required type="phone" id="phone">
</div>
<div>
    <label for="remark">备注</label>
    <input type="text" id="remark">
</div>